<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/frontend/layout.jsp">
    <s:layout-component name="content">
        <s:useActionBean beanclass="cz.muni.fi.pa165.travelagency.web.frontend.OrderActionBean" var="actionBean"/>
        
        <div id="order">
            <center><h2><f:message key="order" /></h2></center>

            <h3><f:message key="package-tour" />: <c:out value="${actionBean.packageTour.name}" /></h3>

            <div><span class="pt-label">
                     <f:message key="ptour.destination"/>: </span>
                     <c:out value="${actionBean.packageTour.destination}"/>
             </div>
             <div><span class="pt-label">
                     <f:message key="ptour.date"/>: </span>
                     <f:formatDate value="${actionBean.packageTour.start}" pattern="dd. MM. yyyy" /> - <f:formatDate value="${actionBean.packageTour.end}" pattern="dd. MM. yyyy" />
             </div>

             <div><span class="pt-label">
                     <f:message key="ptour.pricePerPerson"/>: </span>
                     <c:out value="${actionBean.packageTour.pricePerPerson}"/>
             </div>

             <br>
             <hr>
             <br>
             
             <s:form beanclass="cz.muni.fi.pa165.travelagency.web.frontend.OrderActionBean">
                <s:errors/>
                <table>
                    <tr>
                        <th><s:label for="o1" name="customer.name"/>: </th>
                        <td><s:text id="o1" name="customer.name"/></td>
                    </tr>
                    <tr>
                        <th><s:label for="o2" name="customer.address"/>: </th>
                        <td><s:text id="o2" name="customer.address"/></td>
                    </tr>
                    <tr>
                        <th><s:label for="o3" name="customer.phone-number"/>: </th>
                        <td><s:text id="o3" name="customer.phoneNumber" value="+420 "/></td>
                    </tr>                
                    <tr>
                        <th><s:label for="o4" name="order.numberOfPersons"/>: </th>
                        <td><s:text id="o4" name="order.numberOfPersons" size="2" value="1"/> max: <c:out value="${actionBean.packageTourAvailablePlaces > 0 ? actionBean.packageTourAvailablePlaces : 0}"/></td>
                    </tr>
                    <tr>
                        <th><s:label name="tours"/>: </th>
                        <td>
                            <c:forEach items="${actionBean.packageTour.availableTours}" var="tour">
                                <s:checkbox name="${tour.id}"/> ${tour.name}<br>
                            </c:forEach>
                        </td>
                    </tr>                    
                </table>
                <br>
                <s:param name="package-tour.id" value="${actionBean.packageTour.id}"/>
                <s:submit name="submit"><f:message key="order.submit" /></s:submit>
                <s:submit name="cancel"><f:message key="order.action.edit.cancel" /></s:submit>
            </s:form>
        </div>
    </s:layout-component>
</s:layout-render>